package com.mas.admin.biz.dal.mysql.users;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mas.admin.biz.dal.dataobject.users.AdminUserDO;
import com.mas.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @author godyao
 * @description 用户Mapper
 * @date 2023年01月19日17:23
 */
@Mapper
public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
    default List<AdminUserDO> getUsersByStatus(Integer status) {
        return selectList(new LambdaQueryWrapper<AdminUserDO>()
                .select(AdminUserDO::getId, AdminUserDO::getNickname)
                .eq(AdminUserDO::getStatus, status));
    }

    default AdminUserDO selectByUsername(String username) {
        return selectOne(AdminUserDO::getUsername, username);
    }
}
